package cn.tedu.opencv.ex;

import lombok.Getter;

import javax.servlet.http.HttpServletResponse;

/**
 * 状态码和相应提示消息枚举类
 *
 * @author xukai
 * @date 20200418
 */
@Getter
public enum ResultCodeEnum {

    SUCCESS(HttpServletResponse.SC_OK, "成功"),

    PARAMETER_ERROR(HttpServletResponse.SC_BAD_REQUEST, "参数错误"),

    UNAUTHORIZED(HttpServletResponse.SC_UNAUTHORIZED, "未授权，将跳转未授权提示页"),

    FORBIDDEN(HttpServletResponse.SC_FORBIDDEN, "未认证，将跳转登录页"),

    NOT_FOUND(HttpServletResponse.SC_NOT_FOUND, "404 没有发现"),

    METHOD_NOT_SUPPORTED(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "方法不支持"),

    MEDIA_TYPE_NOT_SUPPORTED(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, "媒体类型不支持"),

    REQUEST_TIMEOUT(HttpServletResponse.SC_REQUEST_TIMEOUT, "请求超时，请稍后再试"),

    INTERNAL_SERVER_ERROR(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "服务内部拒绝服务"),

    TOKEN_INVALID(600, "登录凭证失效，请您重新登录"),

    ACCOUNT_THIRD_LOGIN(601, "账号在其他移动终端登录");

    ResultCodeEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    /**
     * 状态码
     */
    private int code;

    /**
     * 给前端用于提示的消息
     */
    private String message;

}
